home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nejlepší hry
/
Nejlepsi hry.iso
/
hry
/
sea of chaos
/
sea_install.msi
/
_15C39AAA7726369D39812BD40F01CF6A
/
_533B598138B841DEAFEFB2BD12D321F2
< prev
next >
Wrap
Text File
|
2005-03-08
|
1KB
|
71 lines
//sky vertex shader:
//moves texture coordinates with time
//generates textures coordinates for 2 layers of sky
//Luke Lenhart
//(C)2004-2005 Digipen Institute of Technology
//brightness of sky
float4 skyColor;
//scale of cloud size
float scale;
//alpha value of layer
float alpha;
//world,view,projection transform
float4x4 matWorldViewProj;
//current time (in seconds) since whenever
float curTime;
//shader input
struct VS_INPUT
{
float4 Pos : POSITION;
float2 Tex0 : TEXCOORD0;
};
//shader output
struct VS_OUTPUT
{
float4 Pos : POSITION;
float4 Color : COLOR;
float2 Tex0 : TEXCOORD0;
float2 Tex1 : TEXCOORD1;
};
//shader code
VS_OUTPUT VShader(VS_INPUT In)
{
VS_OUTPUT Out;
//calc transformed position
Out.Pos=mul(matWorldViewProj,In.Pos);
float2 postxt=float2(In.Pos.x,In.Pos.y);
Out.Tex0=postxt*0.75f+float2(curTime*.038,curTime*.007);
Out.Tex1=scale*(postxt+float2(curTime*-.0127,curTime*.011));
//make vert color
Out.Color=skyColor;
Out.Color.a=1.0f;
//if z is near 0, fade it out
if (In.Pos.z<=0.0f)
{
Out.Color.a=0.0f;
}
else if (In.Pos.z<0.05f)
{
Out.Color.a=0.35f;
}
//apply alpha
Out.Color.a*=alpha;
//spit out the results
return Out;
}